<template>
	<div>
		<div class="tabNav">
			<router-link to="/index">
        <img src="../assets/img/sidebar1.png" />首页
      </router-link>
      <b>/<img style="top: 1px" src="../assets/img/personal.png" />经营者信息</b>
			<el-input 
				placeholder="请输入企业名称/统一社会信用代码/灵活用工平台名称进行搜索" 
				suffix-icon="el-icon-search" 
				@change="searchMethods"
				v-model="searchValue">
			</el-input>
			<em><i style="font-size: 16px;margin-right: 5px;" class="el-icon-s-data"></i>经营者数量：{{ settlementCountObj }}</em>
		</div>
		<el-row :gutter="24">
			<el-col :span="24">
				<el-card class="cardTits cardTitss cardTitdd" shadow="hover">
					<individual-table ref="searchMethods" :search="searchValue"></individual-table>
				</el-card>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import IndividualTable from '../components/table/IndividualTable.vue'
	export default {
		name: "dashboard",
		data() {
			return {
				name: localStorage.getItem("ms_username"),
				value: '',
				searchValue: '',
				settlementCountObj: 0
			};
		},
		components: {
			IndividualTable
		},
		computed: {
			role() {
				return this.name === "admin" ? "超级管理员" : "普通用户";
			}
		},
		mounted() {
			this.settlementCount()
		},
		methods: {
			searchMethods() {
				// 搜索
				this.$refs.searchMethods.getTableData()
			},
			settlementCount() {
				// 获取个体户数量
				this.$http({
					url: '/api/selfbusiness/selectSelfBusinessCount',
					method: 'post',
					headers: {
						'Content-Type': 'application/json'
					}
				}).then(data => {
					if(data.code === 0) {
						this.settlementCountObj = data.result
					}
				})
			},
			handleSizeChange(val) {
				console.log(`每页 ${val} 条`);
			},
			handleCurrentChange(val) {
				console.log(`当前页: ${val}`);
			}
		}
	};
</script>
